function doRedirectWorkWix(vehicleDD, manufacturerDD, modelDD, languageName) {
    var d = document;
    var vehicleId = d.getElementById(vehicleDD).value;
    var manufacturerId = d.getElementById(manufacturerDD).value;
    var modelId = d.getElementById(modelDD).value;
	
    if (vehicleId && manufacturerId && modelId) {
        switch (vehicleId) {
            case '6':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchWixHighway", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '7':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchWixPassenger", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '8':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchWixHeavy", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '9':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchWixMotorcycle", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            case '10':
                window.location = "http://wixeurope.com/" + getTranslation("mainSearchWixQuad", languageName) + "?vehicleId=" + vehicleId + "&manufacturerId=" + manufacturerId + "&modelId=" + modelId + "&languageName=" + languageName;
                break;
            default:
                return false;
        }
    }
}

function doBrandWorkWix(masterComboId, detailComboId, languageName) {

    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        if (parentCombo) {
            if (detailComboId) {
                var url = "../../../Ajax/BrandMasterDetailAjax.aspx?masterItemId=" + parentCombo.value + "&languageName=" + languageName;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split(",");
                                if (options[0] != "")
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideBrandCombo(detailComboId);
                        } //if
                    } //if state
                } //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function doTypeWorkWix(masterComboId, detailComboId, languageName) {

    httpObject = getHTTPObject();
    if (httpObject != null) {
        var parentCombo = document.getElementById(masterComboId);
        if (parentCombo) {
            if (detailComboId) {
                var url = "../../../Ajax/ModelMasterDetailAjax.aspx?masterItemId=" + parentCombo.value + "&languageName=" + languageName;
                httpObject.open("GET", url, true);
                httpObject.onreadystatechange = function() {
                    if (httpObject.readyState == 4) {
                        var combo = document.getElementById(detailComboId);
                        if (combo != null) {
                            combo.options.length = 0;
                            var response = httpObject.responseText;
                            var items = response.split(";");
                            var count = items.length;
                            for (var i = 0; i < count; i++) {
                                var options = items[i].split("|");
                                if (options[0] != "")
                                    combo.options[i] = new Option(options[0], options[1]);
                            } //for
                            showHideBrandCombo(detailComboId);
                        } //if
                    } //if state
                } //func
                httpObject.send(null);
            } //if
        } //if
    } //if
}

function clearBrandCombo(comboId) {
    if (comboId) {
        var comboToClear = document.getElementById(comboId);
        if (comboToClear) {
            comboToClear.options.length = 0;
            comboToClear.options[0] = new Option("---", -1);
        } //if
    } //if
}

function showHideBrandCombo(comboId) {
    if (comboId) {
        var item = document.getElementById('div' + comboId);
        if (item) {
            var comboToShowHide = document.getElementById(comboId);
            if (comboToShowHide) {
                if (comboToShowHide.options) {
                    if (comboToShowHide.options.length <= 1) {
                        item.style.display = 'none';
                    } else {	//if
                        item.style.display = 'block';
                    } //else
                } //if
            } //if
        } //if
    } //if
}

function doActiveSubmitWIX(languageName) {
	var vehdd = jQuery("#id_masterWix");
	var branddd = jQuery("#id_BrandDetailWix");
	var typedd = jQuery("#id_TypeDetailWix");
	var submitdd = jQuery("#ddsubmitWix");
	if ((vehdd.val != -1) && (branddd.val != -1) && (typedd.val != -1)) {
		submitdd.attr("href", "javascript:doRedirectWorkWix('id_masterWix', 'id_BrandDetailWix', 'id_TypeDetailWix', '"+languageName+"')");
		//submitdd.css("background", "#1b1818");
		submitdd.css("cursor", "pointer");
	}
	if ((vehdd.val == -1) || (branddd.val == -1) || (typedd.val == -1)) {
		submitdd.attr("href", "javascript: return false;");
		//submitdd.css("background", "#1b1818");
		submitdd.css("cursor", "default");
	}
}

